<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<%@ include file="/static/htm/head" %>
		<title>游戏论坛帖子专区</title>
	</head>
	<body style="font-size:15px;">
			<div style="text-align: center;">
			<a href="index.jsp">
				<img alt="论坛Logo" height="56" src="static/pic/logo.jpg" width="192">
			</a>
		</div>
		<table width="100%">
			<tr>
				<td>
					<a href="index.jsp">
						返回论坛首页
					</a>
				</td>
				<td style="text-align: right;">
					<%@ include file="/static/htm/user.jsp" %>
				</td>
			</tr>
		</table>
		<br/>
		<c:if test="${param.type eq '1' }">
		<table class="table table-striped" width="100%">
        <thead>
          <tr>
            <th>#</th>
            <th>名称</th>
            <th>价格(元)</th>
            <th>订单状态</th>
            <th>
            	分账账号
            </th>
            <th>
            	买家id
            </th>
            <th>
            	买家备注
            </th>
            <th>
            	操作
            </th>
          </tr>
        </thead>
        <tbody>
          <c:if test="${sbill ne null}">
	          <c:forEach var="bill" items="${sbill }" varStatus="num">
	          	<tr>
	          		<td>
	          			${num.index + 1}
	          		</td>
	          		<td>
	          			${bill.pdesc }
	          		</td>
	          		<td>
	          			${bill.total_fee / 100.0 }
	          		</td>
	          		<td>
	          			<c:choose>
	          				<c:when test="${bill.state eq 'R' }"><font color="red">退款中</font></c:when>
	          				<c:when test="${bill.state eq 'P' }">已支付</c:when>
	          				<c:when test="${bill.state eq 'N' }">未支付</c:when>
	          				<c:when test="${bill.state eq 'F' }"><font color="red">退款完成</font></c:when>
	          				<c:when test="${bill.state eq 'S' }"><font color="green">交易完成</font></c:when>
	          			</c:choose>
	          		</td>
	          		<td>
	          			${bill.split_no }
	          		</td>
	          		<td>
	          			${bill.buyer_name }
	          		</td>
	          		<td>
	          			${bill.backup_info }
	          		</td>
	          		<td>
	          			<c:if test="${bill.state eq 'R' }">
	          				<a href="permit/agreerefund?spbill_no=${bill.spbill_no}&type=1">同意退款</a>&nbsp;&nbsp;&nbsp;
	          				<a href="permit/agreerefund?spbill_no=${bill.spbill_no }&type=2">不同意退款</a>
		          		</c:if>
	          		</td>
	          	</tr>
	          </c:forEach>
          </c:if>
          <c:if test="${sbill eq null}">
          	<tr>
          		<td colspan="8">
          			您暂时没有发布任何交易
          		</td>
          	</tr>
          </c:if>          
        </tbody>
      </table>
      </c:if>
      <c:if test="${param.type eq '2' }">
      <br/>
		<table class="table table-striped" width="100%">
        <thead>
          <tr>
            <th>#</th>
            <th>名称</th>
            <th>价格(元)</th>
            <th>订单状态</th>
            <th>
            	分账账号
            </th>
            <th>
            	卖家id
            </th>
            <th>
            	买家备注
            </th>
            <th>
            	操作
            </th>
          </tr>
        </thead>
        <tbody>
          <c:if test="${bbill ne null}">
	          <c:forEach var="bill" items="${bbill }" varStatus="num">
	          	<tr>
	          		<td>
	          			${num.index + 1}
	          		</td>
	          		<td>
	          			${bill.pdesc }
	          		</td>
	          		<td>
	          			${bill.total_fee / 100.0 }
	          		</td>
	          		<td>
	          			<c:choose>
							<c:when test="${bill.state eq 'R' }"><font color="red">退款中</font></c:when>
	          				<c:when test="${bill.state eq 'P' }">已支付</c:when>
	          				<c:when test="${bill.state eq 'N' }">未支付</c:when>
	          				<c:when test="${bill.state eq 'F' }"><font color="red">退款完成</font></c:when>
	          				<c:when test="${bill.state eq 'S' }"><font color="green">交易完成</font></c:when>
	          			</c:choose>
	          		</td>
	          		<td>
	          			${bill.split_no }
	          		</td>
	          		<td>
	          			${bill.seller_name }
	          		</td>
	          		<td>
	          			${bill.backup_info }
	          		</td>
	          		<td>
	          			<c:if test="${bill.state eq 'P' }">
	          				<c:set var="now" value="<%=System.currentTimeMillis() %>"/>
	          				<c:if test="${(now - bill['start_time']['time']) < 7 * 24 * 60 * 60 * 1000 }">
		          				<a href="permit/refund?spbill_no=${bill.spbill_no}">退款</a>&nbsp;&nbsp;&nbsp;
		          				<a href="permit/split?spbill_no=${bill.spbill_no }">确认收货</a>
	          				</c:if>
	          				<c:if test="${(now - bill['start_time']['time']) >= 7 * 24 * 60 * 60 * 1000}">
								<font color="red">超过退款时间</font>
							</c:if>	          				
	          			</c:if>
	          		</td>
	          	</tr>
	          </c:forEach>
          </c:if>
          <c:if test="${bbill eq null}">
          	<tr>
          		<td colspan="8">
          			您暂时没有买到任何物品
          		</td>
          	</tr>
          </c:if>          
        </tbody>
      </table>
      </c:if>
      <%@ include file="/static/htm/foot.jsp" %>		      		
	</body>
</html>